package com.javathree;

import java.util.Scanner;

public class Demo2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //存，取--->登录流程:根据用户名和密码比对
        User[] users = new User[5];

        User user = new User();
        user.id=001;
        user.name="zs";
        user.password="123";
        users[0]=user;

        System.out.println("请输入用户名：");
        String uname = scanner.next();
        System.out.println("请输入密码：");
        String password = scanner.next();
        for (int i=0;i<users.length;i++){
            if(users[i] !=null ){
                if(uname.equals(users[i].name) && password.equals(users[i].password)){
                    System.out.println("登录成功...");
                }else {
                    System.out.println("登录失败");
                }
            }
        }

    }
}
